package com.qf.day06.homework1;

import java.util.Random;

public class Soldier extends Hero{
    private int anger;
    public Soldier() {
    }
    public Soldier(int anger) {
        this.anger = anger;
    }

    public Soldier(String name, int focus, int intelligence, int agile, int anger) {
        super(name, focus, intelligence, agile);
        this.anger = anger;
    }


    public void heroicStrike() {
        Random random = new Random();
        if(this.anger<20){
            System.out.println(getName()+"的怒气小于20,打不动了");
        }else{
        int focusRandom=random.nextInt(40)-20+1;
        double aggressivity=(getFocus()*(focusRandom)*0.01+getFocus())*2;
            this.anger-=20;
        System.out.println(getName()+"释放了英勇打击,本次攻击力为:"+aggressivity+",怒气为:"+this.anger);
        }
    }

    public int getAnger() {
        return anger;
    }

    public void setAnger(int anger) {
        this.anger = anger;
    }

    @Override
    public String toString() {
        return "Soldier{" +
                "anger=" + anger +
                "} " + super.toString();
    }
}
